// home/home.js
import { HomeModel } from '../../models/home.js'
let homeModel = new HomeModel()

Page({
  data: {
    mode: 'widthFix',
    imgUrls: [],
    indicatorDots: true,
    autoplay: true,
    interval: 3000,
    duration: 1000
  },

  onShow() {
    this.getBanner();
    this.getNavtype();
  },

  //用户点击右上角分享
  onShareAppMessage() {

  },

  getBanner(){
    homeModel.getBanner((data)=>{
      this.setData({
        imgUrls: data.data,
      })
    })
  },

  getNavtype(){
    homeModel.getNavtype((data)=>{
      this.setData({
        navType : data.data
      })
    })
  },

  //跳转到方位查询页面
  navigateToMap(){
    wx.navigateTo({
      url: '/pages/map/map',
    })
  },

  //跳转到地图合成页面
  navigateToCompose() {
    wx.navigateTo({
      url: '/pages/compose/compose',
    })
  }
})